package com.huasan.www.demon.data.service.impl;
import com.huasan.www.demon.util.OnePage;
import com.huasan.www.demon.util.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.huasan.www.demon.data.dao.TestMapper;
import com.huasan.www.demon.data.service.TestService;

import com.huasan.www.demon.pojo.Test;
import com.huasan.www.demon.pojo.TestExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;

@Service("testService")
public class TestServiceImpl implements TestService{
	
    @Autowired
    private TestMapper testDao;    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table test
     *
     * @mbggenerated Tue Jan 21 00:39:04 CST 2014
     */
    public int countByExample(TestExample example){
      return testDao.countByExample(example);
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table test
     *
     * @mbggenerated Tue Jan 21 00:39:04 CST 2014
     */
    public int deleteByExample(TestExample example){
      return testDao.deleteByExample(example);
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table test
     *
     * @mbggenerated Tue Jan 21 00:39:04 CST 2014
     */
    public int deleteByPrimaryKey(Long id){
      return testDao.deleteByPrimaryKey(id);
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table test
     *
     * @mbggenerated Tue Jan 21 00:39:04 CST 2014
     */
    public int insert(Test record){
      return testDao.insert(record);
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table test
     *
     * @mbggenerated Tue Jan 21 00:39:04 CST 2014
     */
    public int insertSelective(Test record){
      return testDao.insertSelective(record);
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table test
     *
     * @mbggenerated Tue Jan 21 00:39:04 CST 2014
     */
    public List<Test> selectByExample(TestExample example){
      return testDao.selectByExample(example);
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table test
     *
     * @mbggenerated Tue Jan 21 00:39:04 CST 2014
     */
    public Test selectByPrimaryKey(Long id){
      return testDao.selectByPrimaryKey(id);
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table test
     *
     * @mbggenerated Tue Jan 21 00:39:04 CST 2014
     */
    public int updateByExampleSelective(@Param("record") Test record, @Param("example") TestExample example){
      return testDao.updateByExampleSelective(record,example);
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table test
     *
     * @mbggenerated Tue Jan 21 00:39:04 CST 2014
     */
    public int updateByExample(@Param("record") Test record, @Param("example") TestExample example){
      return testDao.updateByExample(record,example);
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table test
     *
     * @mbggenerated Tue Jan 21 00:39:04 CST 2014
     */
    public int updateByPrimaryKeySelective(Test record){
      return testDao.updateByPrimaryKeySelective(record);
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table test
     *
     * @mbggenerated Tue Jan 21 00:39:04 CST 2014
     */
    public int updateByPrimaryKey(Test record){
      return testDao.updateByPrimaryKey(record);
    }

    public OnePage<Test> selectOnePageByExample(TestExample example){
    	int count = testDao.countByExample(example);
    	List<Test> dataList = testDao.selectByExample(example);
    	OnePage<Test> onepage = new OnePage<Test>();
    	onepage.setPage(new Page(example.getLimitStart(), example.getLimitEnd()));
    	onepage.getPage().setCount(count);
    	onepage.setDataList(dataList);
    	return onepage;
    }
}